/*
 * @Author: your name
 * @Date: 2021-12-23 00:04:14
 * @LastEditTime: 2021-12-23 00:17:46
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \Flutter_Learning\Dart_Basic_Grammer\number_type.dart
 */

/**
 * Number:
 *    1. int
 *    2. double
 * 
 * String:
 *    1. String
 * 
 * Booleans
 *    1. bool
 * 
 * List: 数组
 *    在 Dart 中，数组是列表对象，所以大多数人称为列表
 * 
 * Maps: 字典
 *    通常来说，Map是一个键值对相关对象
 */


void main(List<String> args) {
    int a = 2;

    String str = "hello world";

    bool b = true;

    var ll = [1, 2, 3];
    print(ll[0]);
    print(ll.length);
    
    var l2 = <String>["hello", "world"];
    print(l2[0]);

    // 通过中括号进行创建的 List 容量可变
    // 实际上 List 容量都可变
    var l3 = [];
    l3.add("hello");
    l3.add("l3");
    print(l3[1]);

    
    // 创建一个固定长度的 List
    var l4 = List.filled(3, "");
    l4[0] = "hello";
    print(l4[0]);
    
    var l5 = List<String>.filled(3, "");
    l5[0] = "hello";
    print(l5[0]);

    

    // Mapping
    var person = {
        "name": "Simon",
        "age": 20
    };

    print(person);
    print(person["name"]);
    print(person["age"]);

    var p = new Map();
    p["name"] = "Simon";
    p["age"] = 20;
    print(p);
    print(p["age"]);


    // 判断类型 is
    var ss = "12343";
    if (ss is String) {
        print("Sring Type");
    } else {
        print("int type");
    }






}